{imp:"uio/_laypc"}<!--模板继承-->

{block:minit}{:parent}{code:"_config/user_login"}{/block:minit}

{block:action}

{if $user->userFlag=='Error' }

    <div class="text-danger bg-warning pa10">
      <p class="text-danger bg-warning right w350 pa10" style="margin:-10px -10px 0px 0px">
        {lang(user.lon_erlock)} 
      </p>
      <p> {lang(user.lon_ercnt,$user->usess['errno'])} </p>
      <p> {lang(user.lon_lockto)}：{php echo date('Y-m-d H:i:s',$user->usess['stime']+$user->utmOut); }  </p>
    </div>

{elseif $user->userFlag=='Login' }

    <div class="text-danger bg-warning pa10">
      <p class="text-danger bg-warning right w350 pa10" style="margin:-10px -10px 0px 0px"> {lang(user.lon_change)}【<a href="?uio-logout">{lang(user.lon_logout)}</a>】;  <br>
          {lang(user.lon_touto)}：{php echo date('Y-m-d H:i',$user->usess['stime']+$user->utmOut); }  
      </p>
      [{=$user->usess['uname']}] {lang(user.lon_logined)}
      <a href="{surl(0)}">{lang(user.pub_cuser)}</a><!--:home-login-->
    </div>

{elseif !empty($remsg) }

    <p class="text-danger bg-warning pa10 ma10">{=$remsg}</p>

{else}

  <ul class="nav nav-tabs" nav-justified>
    <li role="presentation" onClick="funcLogin(0)" class="active"><a><i class="fa fa-pencil c33F"></i>{lang(user.lon_3idpw)}</a></li>
    {if !empty($ultypes['weixin']['open'])}
    <li role="presentation" onClick="funcLogin(1)"><a><img src="{=PATH_VIEWS}/base/assets/aimg/a3rd-wx.png"  height="22" />{lang(user.lon_3wechat)}</a></li>
    {/if}
    {if !empty($ultypes['qqcon']['open'])}
    <li role="presentation"><a onclick='qqLogin()'><img src="{=PATH_VIEWS}/base/assets/aimg/a3rd-qq_7.png" height="24" /><!--{lang(user.lon_3qqcon)}--></a></li>
    {/if}
  </ul>

  <div class="block-login">
      <div class="right w220 small">
        <p class="pa10">{lang(user.lon_noidpw)}<br>
          <a class="btn btn-warning w130 block" href="{surl(reg)}"><i class="fa fa-floppy-save"></i> {lang(user.lon_reg)}</a>
        </p>
        <p class="pa10">{lang(user.lon_fpass)}?<br>
          <a class="btn btn-warning w130 block" href="{surl(uio-getpw)}"><i class="fa fa-question-sign"></i> {=$karr['getpw']}</a>
        </p>
      </div>

      <div id="idx_lscan" class="left w450" style="display:none;">
          <p class="tc" id="lscan_msg">
          <img src="{=PATH_VIEWS}/base/assets/aimg/loadbig.gif" id="lscan_img" width="250">
          </p>
          <p class="tc">{lang(user.lon_scana)}</p>
      </div>

      <div id="idx_login" class="left w450 pv10">
        <form action="?login" method="post" name="fmlogin" id="fmlogin">
        <p class="row"> <i class="col-xs-4 col-md-4"><a class="block pt10 c333">{lang(uname)}:</a></i>
          <i class="col-xs-8 col-md-8">
          <input id="fm[uname]" name="fm[uname]" tabindex="1" type="text" class="form-control txt" reg="key:2-15" tip="{lang(admin.fad_uid31546)}" />
          </i>
        </p>
        <p class="row"> <i class="col-xs-4 col-md-4 "><a class="block pt10 c333">{lang(upass)}:</a></i>
          <i class="col-xs-8 col-md-8">
          <input id="fm[upass]" name="fm[upass]" tabindex="2" type="password" class="form-control txt" reg="str:6-25" autocomplete="off" tip="{lang(admin.fad_up624)}" />
          </i>
        </p>
        <p class="row"> <i class="col-xs-4 col-md-4"><a class="block pt10 c333">{lang(vcode)}:</a></i>
          <i class="col-xs-8 col-md-8 tl">
          <script>fsInit('fmlogin');</script>
          </i>
        </p>
        <p class="row"> <i class="col-xs-4 col-md-4"></i>
          <i class="col-xs-8 col-md-8 tr">
          <input name="submit" value="{lang(submit)}" tabindex="19820" type="submit" class="form-control btn btn-primary" />
          <input name="act" type="hidden" value="dologin" />
          <input name="recbk" type="hidden" value="{=$recbk}" />
          </i>
        </p>
        </form>
      </div>

      <div class="clear"></div>
      <div class="note">
        <ol>
          <?php basLang::inc('admin','loginread'); ?>
        </ol>
      </div>
  </div>

{/if}

{/block:action}

{block:footer}
{:parent}
{php}eimp('/~base/jslib/jq_base.js');{/php}
<script>
var ubase = '<?php echo PATH_ROOT."/plus/api/wechat.php?"; ?>';
var iTime = 0;
function funcLogin(scan){
  $('#idx_lscan').toggle();
  $('#idx_login').toggle();
  if(scan){
    fshowQrcode();
    var i0=0, i1=1;
  }else{
    var i0=1, i1=0;
  }
  $('.nav li').eq(i0).removeClass('active');
  $('.nav li').eq(i1).addClass('active');
}
function fshowQrcode(){ // 缓存,更新...
  if(iTime) return;
  var extp = Math.random().toString(36).substr(2); 
  var url = 'actys=getQrcode&qrmod=login&extp='+extp+'&varname=data';
  $.getScript(ubase+url, function(){  //调试
    $('#lscan_img').attr('src',data.url);
    clearTimeout(iTime);
    fcheckLogin(data.sid,extp,data.stampys,data.signys);
  });
}
function fcheckLogin(sid,extp,stampys,signys){
  var url = 'actys=chkLogin&scene='+sid+'&extp='+extp+'&stampys='+stampys+'&signys='+signys+'&varname=data';
  $.getScript(ubase+url, function(){ 
    if(typeof(data.error)=='undefined' || typeof(data.message)=='undefined' ){
      alert('{lang(user.lon_errsvr)}');
      return '';
    //}else if(data.user_info.mid=="-1"){
      //$('#msg_res').html("已经是登录状态，请先登出！<br>mid="+data.user_ibak.mid+"<br>mname="+data.user_ibak.mname+"");
      //return '';
    }else if(data.uname){
      $('#lscan_msg').html("["+data.uname+"]{lang(user.lon_lonok)}");
      location.reload();
      return '';
    } 
    iTime = setTimeout("fcheckLogin('"+sid+"','"+extp+"','"+stampys+"','"+signys+"')",2000);
  }); 
}
//以下为按钮点击事件的逻辑。注意这里要重新打开窗口
//否则后面跳转到QQ登录，授权页面时会直接缩小当前浏览器的窗口，而不是打开新窗口
function qqLogin(){
    var url = _cbase.run.roots+'/a3rd/qqconn/login.php';
    // recbk ??? 
    _cbase.sys_open = 1;
    winOpen(url,'',480,360,'qqLogin');
} 
</script>
{/block:footer}
